class Solution {
public:
    bool isPalindrome(int x) {
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
        if (x < 0) {
            return false;
        }
        int high = 1;
        while (x / high >= 10) {
            high *= 10;
        }

        int low = 1;
        while (high > low) {
            if (x / high % 10 != x / low % 10) {
                return false;
            }
            high /= 10;
            low *= 10;
        }
        return true;

    }
};